import 'package:flutter/material.dart';

class itme extends StatelessWidget {
  const itme({Key key, this.imgcode}) : super(key: key);
  final int imgcode;
  @override
  Widget build(BuildContext context) {
    double width = MediaQuery.of(context).size.width;
    return Container(
      margin: EdgeInsets.only(bottom: 20),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              GestureDetector(
                child: Container(
                  child: Row(
                    children: [
                      Container(
                        width: 50,
                        height: 50,
                        child: CircleAvatar(
                          backgroundImage: NetworkImage(
                              'https://img0.baidu.com/it/u=2211738227,770999306&fm=26&fmt=auto'),
                        ),
                      ),
                      Container(
                        height: 40,
                        margin: EdgeInsets.only(left: 10),
                        child: Column(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Text(
                              'Westlife',
                              style: TextStyle(
                                  color: Color(0xff3d3d3d),
                                  fontSize: 15,
                                  fontWeight: FontWeight.w500),
                            ),
                            Text(
                              '08:42 am',
                              style: TextStyle(
                                  color: Color(0xffb8b8b8), fontSize: 13),
                            )
                          ],
                        ),
                      )
                    ],
                  ),
                ),
                onTap: () {
                  Navigator.push(context, MaterialPageRoute(builder: (context) {
                    return Container();
                  }));
                },
              ),
            ],
          ),
          Container(
            margin: EdgeInsets.symmetric(vertical: 15),
            child: Text(
              'Bob Greene 1 In the house where I grew up， it was our custom to leave the front door on the latch at night。 I don t know if that was a local term or if it is universal; on the latch meant the door was closed but not locked。 None',
              style: TextStyle(
                  color: Color(0xff343434),
                  fontSize: 16,
                  fontWeight: FontWeight.w500),
              maxLines: 5,
              overflow: TextOverflow.ellipsis,
            ),
          ),
          imgstyle(imgcode),
          Container(
            margin: EdgeInsets.only(top: 15),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Container(
                  height: 30,
                  // width: 0.5 * (width - 30),
                  child: Container(
                    padding: EdgeInsets.symmetric(horizontal: 10),
                    decoration: BoxDecoration(
                        color: Color(0xfffffcf2),
                        borderRadius: BorderRadius.circular(15)),
                    child: Row(
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        Icon(
                          Icons.place,
                          color: Theme.of(context).primaryColor,
                          size: 15,
                        ),
                        Text(
                          ' HuiZhou',
                          style: TextStyle(
                              color: Theme.of(context).primaryColor,
                              fontWeight: FontWeight.w500,
                              fontSize: 15),
                        )
                      ],
                    ),
                  ),
                ),
                Container(
                  width: 0.5 * (width - 30),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Container(
                        child: Row(
                          children: [
                            Icon(
                              Icons.share,
                              size: 18,
                              color: Color(0xff1e242f),
                            ),
                            Text(
                              ' 87',
                              style: TextStyle(
                                  color: Color(0xff969696),
                                  fontWeight: FontWeight.w500,
                                  fontSize: 14),
                            )
                          ],
                        ),
                      ),
                      Container(
                        child: Row(
                          children: [
                            Icon(
                              Icons.feedback,
                              size: 18,
                              color: Color(0xff1e242f),
                            ),
                            Text(
                              ' 36',
                              style: TextStyle(
                                  color: Color(0xff969696),
                                  fontWeight: FontWeight.w500,
                                  fontSize: 14),
                            )
                          ],
                        ),
                      ),
                      Container(
                        child: Row(
                          children: [
                            Icon(
                              Icons.favorite,
                              size: 18,
                              color: Color(0xff1e242f),
                            ),
                            Text(
                              ' 12',
                              style: TextStyle(
                                  color: Color(0xff969696),
                                  fontWeight: FontWeight.w500,
                                  fontSize: 14),
                            )
                          ],
                        ),
                      )
                    ],
                  ),
                )
              ],
            ),
          )
        ],
      ),
    );
  }
}

class imgstyle1 extends StatelessWidget {
  const imgstyle1({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    double width = MediaQuery.of(context).size.width - 40;
    return Container(
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Container(
            width: 0.45 * width,
            height: 0.45 * width * (4 / 3),
            decoration: BoxDecoration(),
            child: ClipRRect(
              borderRadius: BorderRadius.circular(20),
              child: Image(
                fit: BoxFit.fitWidth,
                image: NetworkImage(
                    'https://img1.baidu.com/it/u=2290651451,2877741819&fm=26&fmt=auto'),
              ),
            ),
          ),
          Container(
            width: 0.55 * width,
            height: 0.45 * width * (4 / 3),
            decoration: BoxDecoration(),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Container(
                  width: double.infinity,
                  height: 0.5 * 0.45 * width * (4 / 3) - 5,
                  decoration: BoxDecoration(),
                  child: ClipRRect(
                    borderRadius: BorderRadius.circular(20),
                    child: Image(
                      fit: BoxFit.fitWidth,
                      image: NetworkImage(
                          'https://img1.baidu.com/it/u=1316800099,2051258115&fm=26&fmt=auto'),
                    ),
                  ),
                ),
                Container(
                  width: double.infinity,
                  height: 0.5 * 0.45 * width * (4 / 3) - 5,
                  decoration: BoxDecoration(),
                  child: ClipRRect(
                    borderRadius: BorderRadius.circular(20),
                    child: Image(
                      fit: BoxFit.fitWidth,
                      image: NetworkImage(
                          'https://img1.baidu.com/it/u=2881992720,703397733&fm=26&fmt=auto'),
                    ),
                  ),
                )
              ],
            ),
          )
        ],
      ),
    );
  }
}

Widget imgstyle(int stylecode) {
  if (stylecode == 0) {
    return imgstyle1();
  } else if (stylecode == 1) {
    return imgstyle2();
  } else if (stylecode == 2) {
    return imgstyle3();
  }
  return imgstyle4();
}

class imgstyle2 extends StatelessWidget {
  const imgstyle2({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    double width = MediaQuery.of(context).size.width - 30;
    return Container(
      width: width,
      child: ClipRRect(
        borderRadius: BorderRadius.circular(20),
        child: Image(
          fit: BoxFit.fitWidth,
          image: NetworkImage(
              'https://img2.baidu.com/it/u=3643648615,1379429149&fm=26&fmt=auto'),
        ),
      ),
    );
  }
}

class imgstyle3 extends StatelessWidget {
  const imgstyle3({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    double width = MediaQuery.of(context).size.width - 30;
    return Container(
      width: width * 0.5,
      child: ClipRRect(
        borderRadius: BorderRadius.circular(20),
        child: Image(
          fit: BoxFit.fitWidth,
          image: NetworkImage(
              'https://img0.baidu.com/it/u=3239470131,3433763396&fm=26&fmt=auto'),
        ),
      ),
    );
  }
}

class imgstyle4 extends StatelessWidget {
  const imgstyle4({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    double width = MediaQuery.of(context).size.width - 45;
    return Container(
      child: Column(
        children: [
          Container(
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Container(
                  width: width * (1 / 3),
                  height: width * (1 / 3),
                  decoration: BoxDecoration(),
                  child: ClipRRect(
                    child: Image(
                      fit: BoxFit.fitWidth,
                      image: NetworkImage(
                          'https://img2.baidu.com/it/u=1304311584,2108720111&fm=26&fmt=auto'),
                    ),
                  ),
                ),
                Container(
                  width: width * (1 / 3),
                  height: width * (1 / 3),
                  decoration: BoxDecoration(),
                  child: ClipRRect(
                    child: Image(
                      fit: BoxFit.fitWidth,
                      image: NetworkImage(
                          'https://img1.baidu.com/it/u=1562663804,3932124629&fm=26&fmt=auto'),
                    ),
                  ),
                ),
                Container(
                  width: width * (1 / 3),
                  height: width * (1 / 3),
                  decoration: BoxDecoration(color: Colors.amber),
                  child: ClipRRect(
                    child: Image(
                      fit: BoxFit.fitWidth,
                      image: NetworkImage(
                          'https://img0.baidu.com/it/u=3239470131,3433763396&fm=26&fmt=auto'),
                    ),
                  ),
                )
              ],
            ),
          )
        ],
      ),
    );
  }
}
